const Koa = require('koa')
const KoaBody = require('koa-body')
const router = require('./routes')
const path = require('path')
const app = new Koa()

// 添加静态列表服务器
app.use(require('koa-static')(path.resolve(__dirname, 'public')))
// 用于解析body体中的数据
app.use(KoaBody())

require('./utils/connect')

// 把路由加到中间件中
app.use(router.routes())

app.listen(2568, () => {
  console.log('server启动')
})
